from django.urls import re_path
from rest_framework.routers import DefaultRouter

from apps.work.views import WorkModelViewSet, KqOrdersModelViewSet, KqExtendInfoModelViewSet, KqMaintainModelViewSet, \
    KqPriceInfoModelViewSet, KqPumpsModelViewSet,KqAllProjectsModelViewSet

router = DefaultRouter()
router.register(r'kqAllInfo', WorkModelViewSet)
router.register(r'allOrders', KqOrdersModelViewSet)
router.register(r'kqExtendInfo', KqExtendInfoModelViewSet)
router.register(r'kqMaintainInfo', KqMaintainModelViewSet)
router.register(r'kqPriceInfo', KqPriceInfoModelViewSet)
router.register(r'KqPumpsInfo', KqPumpsModelViewSet)
router.register(r'project', KqAllProjectsModelViewSet)

urlpatterns = [

    # ----- 客户中心------------
    # 导出项目
    re_path('kqAllInfo/export/', WorkModelViewSet.as_view({'get': 'export', })),
    # 项目导入模板下载及导入
    re_path('kqAllInfo/importTemplate/',
            WorkModelViewSet.as_view({'get': 'importTemplate', 'post': 'importTemplate'})),
    re_path('kqAllInfo/updateKqInfoStatus/', WorkModelViewSet.as_view({'put': 'update_kq_info_status'})),
    re_path('kqAllInfo/batchUpdateKqInfo/', WorkModelViewSet.as_view({'post': 'batch_update_kq_info_status'})),
    # 批量更新删除状态
    re_path('kqAllInfo/batchDeleteKqInfo/', WorkModelViewSet.as_view({'post': 'batch_delete_kq_info'})),
    # recoverKqInfo 解除一条删除数据
    re_path('kqAllInfo/recoverKqInfo/', WorkModelViewSet.as_view({'post': 'recover_kq_info'})),

    # ----- 订单中心------------
    # 导出项目
    re_path('allOrders/export/', KqOrdersModelViewSet.as_view({'get': 'export', })),
    # 项目导入模板下载及导入
    re_path('allOrders/importTemplate/',
            KqOrdersModelViewSet.as_view({'get': 'importTemplate', 'post': 'importTemplate'})),
    # ----- 订单中心------------
    # 导出项目
    re_path('kqMaintainInfo/export/', KqMaintainModelViewSet.as_view({'get': 'export', })),
    re_path('KqPumpsInfo/export/', KqPumpsModelViewSet.as_view({'get': 'export', })),

]

urlpatterns += router.urls
